package org.wakeful.conn;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author atila camurca
 */
public class ConnectionProperties implements Serializable {

   private String host;
   private String port;
   private String schema;
   private String user;
   private String password;
   private String url;
   private String dbName;
   private String driverClass;
   private String dialect;
   private Integer pid;
   List<String> list = null;

   public ConnectionProperties() {}

   public String getDbName() {
      return dbName;
   }

   public void setDbName(String dbName) {
      this.dbName = dbName;
   }

   public String getDriverClass() {
      return driverClass;
   }

   public void setDriverClass(String driverClass) {
      this.driverClass = driverClass;
   }

   public String getHost() {
      return host;
   }

   public void setHost(String host) {
      this.host = host;
   }

   public String getPassword() {
      return password;
   }

   public void setPassword(String password) {
      this.password = password;
   }

   public String getSchema() {
      return schema;
   }

   public void setSchema(String schema) {
      this.schema = schema;
   }

   public String getUrl() {
      return url;
   }

   public void setUrl(String url) {
      this.url = url;
   }

   public String getUser() {
      return user;
   }

   public void setUser(String user) {
      this.user = user;
   }

   public String getDialect() {
      return dialect;
   }

   public void setDialect(String dialect) {
      this.dialect = dialect;
   }

   public String getPort() {
      return port;
   }

   public void setPort(String port) {
      this.port = port;
   }

   public Integer getPid() {
      return pid;
   }

   public void setPid(Integer pid) {
      this.pid = pid;
   }

   private List<String> getProperties() {
      if (list == null) {
         list = new ArrayList<String>();
         list.add(host);
         list.add(port);
         list.add(schema);
         list.add(user);
         list.add(password);
         list.add(dbName);
         list.add(driverClass);
         list.add(dialect);
      }
      return list;
   }

   public String get(int index) {
      return list.get(index);
   }

   public int size() {
      return getProperties().size();
   }
}
